home *** CD-ROM | disk | FTP | other *** search
/ Apple Developer Connection Student Program / ADC Tools Sampler CD Disk 3 1999.iso / Metrowerks CodeWarrior / Java Support / Java_Source / Java2 / src / java / io / ObjectInput.java < prev    next >
Encoding:
Java Source  |  1999-05-28  |  3.2 KB  |  96 lines  |  [TEXT/CWIE]

  1. /*
  2.  * @(#)ObjectInput.java    1.13 98/09/21
  3.  *
  4.  * Copyright 1996-1998 by Sun Microsystems, Inc.,
  5.  * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
  6.  * All rights reserved.
  7.  * 
  8.  * This software is the confidential and proprietary information
  9.  * of Sun Microsystems, Inc. ("Confidential Information").  You
  10.  * shall not disclose such Confidential Information and shall use
  11.  * it only in accordance with the terms of the license agreement
  12.  * you entered into with Sun.
  13.  */
  14.  
  15. package java.io;
  16.  
  17. /**
  18.  * ObjectInput extends the DataInput interface to include the reading of
  19.  * objects. DataInput includes methods for the input of primitive types,
  20.  * ObjectInput extends that interface to include objects, arrays, and Strings.
  21.  *
  22.  * @author  unascribed
  23.  * @version 1.13, 09/21/98
  24.  * @see java.io.InputStream
  25.  * @see java.io.ObjectOutputStream
  26.  * @see java.io.ObjectInputStream
  27.  * @since   JDK1.1
  28.  */
  29. public interface ObjectInput extends DataInput {
  30.     /**
  31.      * Read and return an object. The class that implements this interface
  32.      * defines where the object is "read" from.
  33.      *
  34.      * @exception java.lang.ClassNotFoundException If the class of a serialized
  35.      *      object cannot be found.
  36.      * @exception IOException If any of the usual Input/Output
  37.      * related exceptions occur.
  38.      */
  39.     public Object readObject()
  40.     throws ClassNotFoundException, IOException;
  41.  
  42.     /**
  43.      * Reads a byte of data. This method will block if no input is
  44.      * available.
  45.      * @return     the byte read, or -1 if the end of the
  46.      *        stream is reached.
  47.      * @exception IOException If an I/O error has occurred.
  48.      */
  49.     public int read() throws IOException;
  50.  
  51.     /**
  52.      * Reads into an array of bytes.  This method will
  53.      * block until some input is available.
  54.      * @param b    the buffer into which the data is read
  55.      * @return  the actual number of bytes read, -1 is
  56.      *         returned when the end of the stream is reached.
  57.      * @exception IOException If an I/O error has occurred.
  58.      */
  59.     public int read(byte b[]) throws IOException;
  60.  
  61.     /**
  62.      * Reads into an array of bytes.  This method will
  63.      * block until some input is available.
  64.      * @param b    the buffer into which the data is read
  65.      * @param off the start offset of the data
  66.      * @param len the maximum number of bytes read
  67.      * @return  the actual number of bytes read, -1 is
  68.      *         returned when the end of the stream is reached.
  69.      * @exception IOException If an I/O error has occurred.
  70.      */
  71.     public int read(byte b[], int off, int len) throws IOException;
  72.  
  73.     /**
  74.      * Skips n bytes of input.
  75.      * @param n the number of bytes to be skipped
  76.      * @return    the actual number of bytes skipped.
  77.      * @exception IOException If an I/O error has occurred.
  78.      */
  79.     public long skip(long n) throws IOException;
  80.  
  81.     /**
  82.      * Returns the number of bytes that can be read
  83.      * without blocking.
  84.      * @return the number of available bytes.
  85.      */
  86.     public int available() throws IOException;
  87.  
  88.     /**
  89.      * Closes the input stream. Must be called
  90.      * to release any resources associated with
  91.      * the stream.
  92.      * @exception IOException If an I/O error has occurred.
  93.      */
  94.     public void close() throws IOException;
  95. }
  96.